package com.yxc.emqxdemo.consumer;

import com.yxc.emqxdemo.configuration.EmqxConsumer;
import com.yxc.emqxdemo.configuration.EmqxConsumerParent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 设备锁死数据消费者
 *
 * @author: YXC
 * @time: 2022/10/17 10:53
 **/
@Slf4j
@Component
@EmqxConsumer(topic = "emqx-demo")
public class Consumer extends EmqxConsumerParent {

    @Override
    public void receiveMessage(String msg) {
        log.info("收到日志: {}", msg);
    }

    @Override
    public void receiveMessages(List<String> msgList) {
        log.info("收到{}条日志: {}", msgList.size(), msgList);
    }
}
